/*******************************************************************************
 * FilePath    : /Software/Examples_Ble_MS1656/ble_app_peripheral_uart_simple/Src/BSP/TIM1.h
 * Version     : 1.0
 * Brief       : 
 * Author      : AndrewHu
 * Company     : Shanghai MacroGiga Electronics CO.,Ltd
 * Email       : Hubinbo@macrogiga.com
 * Date        : 2020-04-03 15:06:14
 * LastEditors : AndrewHu
 * LastEditTime: 2021-06-11 11:29:17
 * Description : 
 ******************************************************************************/
#ifndef _TIM1_H_
#define _TIM1_H_
/* Includes ------------------------------------------------------------------*/
#include <Includes.h>
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
//TIM输出频率 = TIMx_FREQ/TIMx_PERIOD
//TIM时钟频率,注意预分频值是否为整数,即预分频值 = (主频)24000000/(TIM时钟频率)1000000
#define TIM1_FREQ 1000000
//计数值 Max=65535 最快us级 程序指令跑不过来
#define TIM1_PERIOD 100
//占空比预设
#define TIM1_CH2_PULSEWIDTH (TIM1_PERIOD * 0 / 100)

#define TIM1_CH2_PWM_MAX (TIM1_PERIOD * 60 / 100)
#define TIM1_CH2_PWM_CLR 0
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function ----------------------------------------------------------*/
/*******************************************************************************
 * Function    : Tim1_Init
 * Brief       : 灯初始化
 * Parameter   : 
 * Returns     : 
 * Date        : 2020-04-03 16:01:38
 * Description : 
 ******************************************************************************/
void Tim1_Init(void);
/*******************************************************************************
 * Function    : Tim1_CH2_Init
 * Brief       : 通道2输出初始化
 * param        {*}
 * return       {*}
 * Description : 
 * Date        : 2021-06-11 10:11:24
 ******************************************************************************/
void Tim1_CH2_Init(void);
/*******************************************************************************
 * Function    : Tim1_CH2_SetPulse
 * Brief       : 更新PWM占空比
 * param        {u32} value
 * return       {*}
 * Description : 
 * Date        : 2021-06-11 10:17:06
 ******************************************************************************/
void Tim1_CH2_SetPulse(u32 value);
/*******************************************************************************
 * Function    : Tim1_CH2_GetPulse
 * Brief       : 获取占空比
 * param        {*}
 * return       {*}
 * Description : 
 * Date        : 2021-06-11 10:41:20
 ******************************************************************************/
u32 Tim1_CH2_GetPulse(void);
/* extern --------------------------------------------------------------------*/

#endif
